# $Id$
# Maintainer: Jan de Groot <jgc@archlinux.org>
# Maintainer: Pierre Schmitz <pierre@archlinux.de>

pkgname=apr-util
pkgver=1.6.0
pkgrel=1
pkgdesc="The Apache Portable Runtime"
arch=('i686' 'x86_64')
url="http://apr.apache.org/"
depends=('apr' 'expat')
makedepends=('gdbm' 'libldap' 'unixodbc' 'openssl' 'nss' 'sqlite' 'libmariadbclient' 'db' 'postgresql-libs' 'python2')
optdepends=(
  'gdbm: enable gdbm support'
  'libldap: enable ldap support'
  'unixodbc: enable odbc support'
  'libmariadbclient: enable mysql/mariadb support'
  'postgresql-libs: enable postgres support'
  'db: enable berkley db support'
  'sqlite: enable sqlite support'
  'nss: enable nss crypto support'
  'openssl: enable openssl crypto support'
)
license=('APACHE')
source=(https://www.apache.org/dist/apr/apr-util-${pkgver}.tar.bz2{,.asc}
        disable_failing_test.patch   # TODO: figure out why dbm test fails
        buildconf_config.guess_sub_location.patch)
sha256sums=('8474c93fa74b56ac6ca87449abe3e155723d5f534727f3f33283f6631a48ca4c'
            'SKIP'
            'c7da8c0bba36fec72ac8c477f8c71e302ec670ab3df6f33ac5aab9f0527d8c3a'
            '33f3509d8ad089109c70835efc3535b27a6b5fc2fe27793d30689138f8c4f8aa')
validpgpkeys=('5B5181C2C0AB13E59DA3F7A3EC582EB639FF092C' # Jeff Trawick
              '3CE3BAC2EB7BBC624D1D22D8F3B9D88CB87F79A9') # Nick Kew <niq@apache.org>

prepare() {
  cd apr-util-$pkgver
  patch -Np1 -i ../buildconf_config.guess_sub_location.patch
  patch -Np1 -i ../disable_failing_test.patch
  ./buildconf --with-apr=`apr-1-config --srcdir`
}

build() {
  cd "${srcdir}/apr-util-${pkgver}"
  ./configure --prefix=/usr --with-apr=/usr --with-ldap --with-crypto \
    --with-gdbm=/usr --with-sqlite3=/usr --with-nss=/usr --with-odbc=/usr \
    --with-berkeley-db=/usr --with-pgsql=/usr --with-mysql=/usr --with-oracle=/usr \
    --with-openssl=/usr
  make
}

check() {
  cd "${srcdir}/apr-util-${pkgver}"
  make -j1 check
}

package() {
  cd "${srcdir}/apr-util-${pkgver}"
  make DESTDIR="${pkgdir}" install
}
